#!/usr/bin/python
# -*- coding: UTF-8 -*-

#~ A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
#~ a2 + b2 = c2
#~ 
#~ For example, 32 + 42 = 9 + 16 = 25 = 52.
#~ 
#~ There exists exactly one Pythagorean triplet for which a + b + c = 1000.
#~ Find the product abc.
#~ TODO: NOT SOLVED

import time
start = time.clock()

def get():
  a = 1
  b = 1
  c = 1
  while ( 1 ):
    a = 1
    while ( a < 999 ):
      a+=1
      b = 1
      while (b < 999):
        b+=1
        c = max(1000, a + b) - min(1000, a + b)
        print a,b,c
        if ( a * a + b * b == c * c ):
          return a,b,c
    print "HUGE ERROR!"
    return 0, 0, 0


a,b,c = get()
print a, b, c
print a*b*c

print "problem solved in ", (time.clock() - start), "s"
